import { defineStore } from "pinia"
import { getProducts } from "../api/product"

export interface IProduct {
  name: string,
  price: number,
  remain: number
}

export default defineStore('product', {
  state: () => ({
    products: [] as IProduct[]
  }),
  actions: {
    async init() {
      this.products = await getProducts()
    }
  }
})